import myaxios from "../MyAxios";

import URLENV from "@/http/BaseUrl";
const BASEURL = URLENV.BASEURL;

const movieApi = {
  /** 通过ID和类别, 查询电影详情 
   *  @params {Object} params  {id:11}
   *   id: this.$route.params.id,
      type: '电影'
    }
    http://121.37.91.153:3010/query-infosByid?id=2&type=movie
   */
  queryById (params) {
    let url = BASEURL + `/query-infosByid?`;
    return myaxios.get(url, params);
  },

  /** 修改电影信息
   * http://121.37.91.153:3010/admin/yinshi_xiugai
   */
  update (params) {
    let url = BASEURL + "/admin/yinshi_xiugai";
    return myaxios.post(url, params);
  },

  /** 新增电影 */
  add (params) {
    let url = BASEURL + "/admin/yinshi_add";
    return myaxios.post(url, params);
  },


  /**
   * 通过页码/每页条目数据  分页查询电影列表
   * @param {Object} params {page:1, pagesize:3}
   */
  queryAll (params) {
    let url = BASEURL + "/movie-infos";
    return myaxios.get(url, params);
  },

  /**
   * 模糊查询电影列表
   * @param {Object} params {name, page, pagesize,type}
   * /query-infosByname?name=测&page=1&pagesize=10&type=movie
   */
  queryAllByName (params) {
    let url =
      BASEURL +
      `/query-infosByname`;
    return myaxios.get(url, params);
  },

  /**
   * 删除电影
   * @param {Object} params  id和type
   * http://121.37.91.153:3010/query-delete
   */
  delete (params) {
    let url = BASEURL + "/query-delete";
    return myaxios.post(url, params);
  },
};

export default movieApi;
